<%@page import="com.lianjing.sh.spring.web.controller.enhance.operate.Util_Operate"%>
<%@page import="com.lianjing.sh.spring.web.controller.base.operate.OperatableActionBean"%>
<%@page import="com.sh_lianjing.web.el.EL"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%-- 按钮样式 --%>
<c:set var="buttionStyle" value="btn btn-xs btn-info"/>
<%-- 功能 --%>
<c:forEach items="${operates}" var="operate">
<% OperatableActionBean operate = EL.eval("${operate}", OperatableActionBean.class, pageContext); %>
<c:set var="operateUrl" value="${operate.url}"/>
<c:if test="${operate.granted && operate.displaied}">

	<%-- disabled --%>
	<c:set var="disabled" value=""/>
	<c:if test="${operate.disabled}">
	<c:set var="disabled" value="disabled='disabled'"/>
	</c:if>
	<%-- S 弹出类型嵌入相关 --%>
	<c:if test='${operate.target == "Popup"}' >
		<c:set var="onclickString" value='onclick="fun_ReferrerType(this,true);embedsIsContainsOperate_fun(this, false)" src="${RootUrl}${operateUrl}"' />
	</c:if>
	<c:if test='${operate.target != "Popup"}' >
		<c:set var="onclickString" value='href="${RootUrl}${operateUrl}" onclick="fun_ReferrerType(this,false)" target="${operate.target.htmlName}"'/>
	</c:if>
	<c:if test="${operate.accessType=='WithData'}">
		<c:if test='${operate.target != "Popup"}' >
			<c:set var="onclickString" value='class="js_myForm" ${onclickString} '/>
		</c:if>
		<c:if test='${operate.target == "Popup"}' >
			<c:set var="onclickString" value='class="js_withData" ${onclickString} '/>
		</c:if>
	</c:if>
	<%-- E 弹出类型嵌入相关 --%>

	<%-- 操作按钮 --%>
	<div class="${buttionStyle} tooltips" data-toggle="tooltip" title="${operate.explain}" data-placement="top" ${disabled} >

		<c:if test="${operate.accessType=='General' || operate.accessType=='WithData'}" var="accessTypeFlag">
			<c:if test="${operate.accessType=='General'}">
				<a ${onclickString} style="color: white;">
					<c:if test="${operate.actionType=='Add'}">
						<span class="fa fa-plus"></span>
					</c:if>
					<c:if test="${operate.actionType=='Edit'}">
						<span class="glyphicon glyphicon-edit"></span>
					</c:if>
					${operate.comment}
				</a>
			</c:if>
			<c:if test="${operate.accessType=='WithData'}">
				<span ${onclickString} coverAccess="${RootUrl}${operateUrl}" style="color: white;">
					<c:if test="${operate.actionType=='Add'}">
						<span class="fa fa-plus"></span>
					</c:if>
					<c:if test="${operate.actionType=='Edit'}">
						<span class="glyphicon glyphicon-edit"></span>
					</c:if>
					${operate.comment}
				</span>
			</c:if>
		</c:if>
		
		<c:if test="${!accessTypeFlag}">
			<%-- 删除 --%>
			<c:if test="${operate.actionType=='Delete'}">
				<span class="js_dataDelete_body" coverAccess="${RootUrl}${operateUrl}" coverAccessPara="/" style="color: white;" >
					<span class="glyphicon glyphicon-remove"></span> ${operate.comment}
				</span>
			</c:if>
			
			<%-- 导出Excel--%>
			<c:if test="${operate.actionType=='ExcelExport'}">
				<span class="js_dataExcelExport_body" coverAccess="${RootUrl}${operateUrl}" style="color: white;" >
					<span class="glyphicon glyphicon-export"></span> ${operate.comment}
				</span>
			</c:if>
			
			<%-- ajax提交 --%>
			<c:if test="${operate.actionType=='Get' || operate.actionType=='Submit'}">
				<span class="js_dataSubmit_body" coverAccess="${RootUrl}${operateUrl}" coverBindAfterTo="${RootUrl}<%=Util_Operate.returnTo(operate, request)%>" style="color: white;" >
					<span></span> ${operate.comment}
				</span>
			</c:if>
			
			<%-- 文件下载 --%>
			<c:if test="${operate.actionType=='FileDownload'}">
				<a href="${RootUrl}${operateUrl}" style="color: white;" >
					<span></span> ${operate.comment}
				</a>
			</c:if>
			
			<%-- Websocket --%>
			<%-- <c:if test="${operate.actionType=='Message'}">
				<div class="${operate.operateId}" 
				 	com="myWebsocket" run="connect" sendAfterAction="@fun:fun_popup_process()" receiveAfterAction="@fun:fun_popup_process_receive()"
				>
					<a coverReceiveAccess="${operate.sendTo}" coverSendAccess="${RootUrl}${operateUrl}" com-fire="myWebsocket->send" style="color: white;" title="${operate.explain}" >
						${operate.comment}
					</a>
				</div>
			</c:if> --%>
			
			<%-- 其它 --%>
			<c:if test="${operate.actionType=='Other'}">
				<a ${onclickString} style="color: white;">
					${operate.comment}
				</a>
			</c:if>
		</c:if>
	</div>
	
</c:if>
</c:forEach>
<%-- E 功能  --%>